package formularios;

import static dao.BancoDeDados.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class SiacomPai extends javax.swing.JFrame {

    public SiacomPai() {
        try {
            initComponents();
            conectarBancoDados();
            this.setExtendedState(MAXIMIZED_BOTH);
        } catch (Exception ex) {
            Logger.getLogger(SiacomPai.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktop = new javax.swing.JDesktopPane();
        bntRelatorios = new javax.swing.JButton();
        bntVender = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        JMenuItemCadastroClientesPF = new javax.swing.JMenuItem();
        jMenuItemCadastroClientesPJ = new javax.swing.JMenuItem();
        jMenuItemCadastroMercadorias = new javax.swing.JMenuItem();
        jMenuItemCadastroFornecedores = new javax.swing.JMenuItem();
        jMenuItemCadastroUsuarios = new javax.swing.JMenuItem();
        jMenuVendas = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuSobre = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

        bntRelatorios.setText("Relatórios");
        bntRelatorios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntRelatoriosActionPerformed(evt);
            }
        });
        bntRelatorios.setBounds(0, 0, 100, 23);
        desktop.add(bntRelatorios, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bntVender.setText("Vender");
        bntVender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntVenderActionPerformed(evt);
            }
        });
        bntVender.setBounds(100, 0, 80, 23);
        desktop.add(bntVender, javax.swing.JLayeredPane.DEFAULT_LAYER);

        getContentPane().add(desktop);

        jMenu1.setText("Cadastros");

        JMenuItemCadastroClientesPF.setText("Clientes - Pessoa Física");
        JMenuItemCadastroClientesPF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JMenuItemCadastroClientesPFActionPerformed(evt);
            }
        });
        jMenu1.add(JMenuItemCadastroClientesPF);

        jMenuItemCadastroClientesPJ.setText("Clientes - Pessoa Jurídica");
        jMenuItemCadastroClientesPJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCadastroClientesPJActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemCadastroClientesPJ);

        jMenuItemCadastroMercadorias.setText("Mercadorias");
        jMenu1.add(jMenuItemCadastroMercadorias);

        jMenuItemCadastroFornecedores.setText("Fornecedores");
        jMenuItemCadastroFornecedores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCadastroFornecedoresActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemCadastroFornecedores);

        jMenuItemCadastroUsuarios.setText("Usuarios");
        jMenuItemCadastroUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCadastroUsuariosActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemCadastroUsuarios);

        jMenuBar1.add(jMenu1);

        jMenuVendas.setText("Vendas");

        jMenuItem1.setText("Vender");
        jMenuVendas.add(jMenuItem1);
        jMenuVendas.add(jMenuItem2);

        jMenuBar1.add(jMenuVendas);

        jMenuSobre.setText("Sobre");
        jMenuSobre.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuSobreMouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenuSobre);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemCadastroUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCadastroUsuariosActionPerformed

        frmCadastroUsuario painel_usuario = new frmCadastroUsuario();
        desktop.add(painel_usuario);
        painel_usuario.setVisible(true);

    }//GEN-LAST:event_jMenuItemCadastroUsuariosActionPerformed

    private void JMenuItemCadastroClientesPFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JMenuItemCadastroClientesPFActionPerformed

        frmCadastroClientePF painel_clientePF = new frmCadastroClientePF();
        desktop.add(painel_clientePF);
        painel_clientePF.setVisible(true);

    }//GEN-LAST:event_JMenuItemCadastroClientesPFActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        desconectarBancoDados();
    }//GEN-LAST:event_formWindowClosed

    private void jMenuItemCadastroClientesPJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCadastroClientesPJActionPerformed
        frmCadastroClientePJ painel_clientePJ = new frmCadastroClientePJ();
        desktop.add(painel_clientePJ);
        painel_clientePJ.setVisible(true);
    }//GEN-LAST:event_jMenuItemCadastroClientesPJActionPerformed

    private void jMenuItemCadastroFornecedoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCadastroFornecedoresActionPerformed
        frmCadastroFornecedor painel_fornecedor = new frmCadastroFornecedor();
        desktop.add(painel_fornecedor);
        painel_fornecedor.setVisible(true);
    }//GEN-LAST:event_jMenuItemCadastroFornecedoresActionPerformed

    private void bntRelatoriosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntRelatoriosActionPerformed
        frmRelatorio painel_relatorio = new frmRelatorio();
        desktop.add (painel_relatorio);
        painel_relatorio.setVisible(true);
    }//GEN-LAST:event_bntRelatoriosActionPerformed

    private void bntVenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntVenderActionPerformed
        frmVenda painel_venda = new frmVenda();
        desktop.add(painel_venda);
        painel_venda.setVisible(true);
    }//GEN-LAST:event_bntVenderActionPerformed

    private void jMenuSobreMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuSobreMouseClicked
        frmSobre painel_sobre = new frmSobre();
        desktop.add(painel_sobre);
        painel_sobre.setVisible(true);
    }//GEN-LAST:event_jMenuSobreMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new SiacomPai().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem JMenuItemCadastroClientesPF;
    private javax.swing.JButton bntRelatorios;
    private javax.swing.JButton bntVender;
    public static javax.swing.JDesktopPane desktop;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItemCadastroClientesPJ;
    private javax.swing.JMenuItem jMenuItemCadastroFornecedores;
    private javax.swing.JMenuItem jMenuItemCadastroMercadorias;
    private javax.swing.JMenuItem jMenuItemCadastroUsuarios;
    private javax.swing.JMenu jMenuSobre;
    private javax.swing.JMenu jMenuVendas;
    // End of variables declaration//GEN-END:variables
}
